/*
 * @Author: aggfb 714740235@qq.com
 * @Date: 2024-11-19 22:41:20
 * @LastEditors: asd 714740235@qq.com
 * @LastEditTime: 2024-12-28 20:35:49
 * @FilePath: \wire_receiver_box\system\main.c
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

#include "main.h"
#include "com_lora.h"
#include "crc16.h"
#include "e32_900.h"
#include "task_manager.h"

#include <stdio.h>

/*******************************************************************
 * 函数名:
 * 功 能: 入口函数
 * 输 入:
 * 输 出:
 *******************************************************************/
int main(void)
{
    systick_config();
    uint32_t ck_sys = rcu_clock_freq_get(CK_SYS);
    uint32_t ck_ahb = rcu_clock_freq_get(CK_AHB);
    uint32_t ck_apb1 = rcu_clock_freq_get(CK_APB1);
    uint32_t ck_apb2 = rcu_clock_freq_get(CK_APB2);
    SEGGER_RTT_printf(0, "ck_[sys:%d;ahb:%d;apb1:%d;apb2:%d;]\r\n", \
                          ck_sys, ck_ahb, ck_apb1, ck_apb2);
    bsp_board_init();

    bsp_delay_ms(100);
    uint8_t addr = bsp_gpio_read_adrr();
    do/* 配置 lora 模块 参数 */
    {
        if(e32_900_config() == 0)
        {
            break;
        }
        bsp_delay_ms(200);
    } while (1);

    start_task();

    vTaskStartScheduler();

    while(1)
    {
        ;
    }
}
